home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: more problems with qsort
- Date: 02 Mar 1996 19:20:03 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar2122003@qcd.lanl.gov>
- References: <177399702S86.JW1675A@american.edu> <4h0j9e$ng5@clarknet.clark.net>
- <4h8bud$1vd@castle.nando.net>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: actuary@nando.net's message of 2 Mar 1996 02:31:41 GMT
-
- In article <4h8bud$1vd@castle.nando.net>
- actuary@nando.net (Bill McCarthy) writes:
-
- <snip>
- BM: int compare( const void *a, const void *b )
- BM: {
- BM: return strcmp( *(const char **)a, *(const char **)b );
- BM: }
-
- Make that
-
- int compare(const void *a, const void *b)
- {
- char *const * x = a;
- char *const * y = b;
- return strcmp(*x,*y);
- }
-
- Where I have shown only the `const's that I consider `necessary'. You
- may add any other consts that you like, but `casting a const away'
- always leaves a bad taste in my mouth, even if it is harmless.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-